<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //创建方法一：通过new Object()直接创建对象
        var person = new Object();
        person.name="张三"
        person.age=20
        console.log(person.name)
        console.log(person.age)
        person.eat=function(){
            console.log(this.name+"吃东西")
        }
        person.eat()
        //创建方法二：通过{}创建对象
        var student={
            name:"李四",
            age:21,
            study:function(){
                console.log(this.name+"学习")
            }
        }
        console.log(student.name)
        console.log(student.age)
        console.log(student.study())
    </script>
</head>
<body>
    
</body>
</html>